// 格式化时间方法
function dateFormat(dateStr) {
    const date = new Date(dateStr);

    const y = padZero(date.getFullYear());
    const m = padZero(date.getMonth() + 1);
    const d = padZero(date.getDate());

    const h = padZero(date.getHours());
    const min = padZero(date.getMinutes());
    const s = padZero(date.getSeconds());

    const str = `${y}-${m}-${d} ${h}:${min}:${s}`;
    return str;
}
function padZero(num) {
    num = num < 10 ? '0' + num : num;
    return num;
}

module.exports = {
    dateFormat
}